home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.3 KB | 60 lines | [TEXT/MSET] |
- \ 28Oct94 dbh updated to 2.5 syntax
-
- (*
-
- StaticText, or non-editable text in the sense that it is not TextEdit text,
- is text that is meant for display only. StaticText remembers everything it
- needs to draw itself including the position in the window, the font, fontsize,
- etc. StaticText is also a selection class so it will follow our standard
- protocol. A maximum of 16 characters will fit in a StaticText object.
-
- Note the heavy reliance on multiple inheritance.
-
- *)
-
-
- :class staticText super{ $16 font point+ nullselect }
-
- :m classinit:
- " Static Text" put: super> $16
- 50 50 moveto: super> point+ ;m
-
- :m new: ( wptr -- )
- drop
- getnew: super> font
- ;m
-
- :m draw:
- get: super> point+ MoveTo \ move graphics pen with MoveTo
- set: super> font \ must always set: the font before drawing
- \ because we have no idea what the current graphport settings are
- get: super> $16 mDrawString ;m
-
- :m erase: \ simply erases the screen display, does not change the string itself
- get: mode \ font ivar data, save on stack for subsequent restore
- konst srcBic put: mode
- draw: self
- put: mode \ restore mode
- ;m
-
- ;class
-
- endload
-
- *** EXAMPLE USE
-
- selwindow w
- test: w
-
- staticText t
- t add: w
-
- staticText t2
- " Helvetica" fontname: t2
- 50 100 moveto: t2
- 20 fontsize: t2
- " Hello World" put: t2
- t2 add: w
-
-
-